<template>
  <div>
    <el-tree :data="list" :props="{label:'name',children:'children'}" />
    <el-row type="flex" justify="end">
      <el-button type="primary">确定</el-button>
      <el-button type="info">取消</el-button>
    </el-row>
  </div>
</template>
<script>
import { getPermissionList } from '@/api/permisson'
import { tranDataToTree } from '@/utils/index'
export default {
  data() {
    return {
      list: [] // 权限站点列表
    }
  },
  created() {
    this.loadPermissionList()
  },
  methods: {
    // 加载权限列表
    async loadPermissionList() {
      try {
        const res = await getPermissionList()
        this.list = tranDataToTree(res.data)
        console.log('getPermissionList', res)
        // 保存数据
      } catch (err) {
        console.log('getPermissionList', err)
      }
    }
  }
}
</script>
